package com.dragon.graduation.userRole.service.impl;

import com.dragon.graduation.userRole.entity.UserRoleEntity;
import com.dragon.graduation.userRole.mapper.UserRoleMapper;
import com.dragon.graduation.userRole.service.UserRoleService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 用户角色表 服务实现类
 * </p>
 *
 * @author dragon
 * @since 2025-02-28 21:23:58
 */
@Service
public class UserRoleServiceImpl extends ServiceImpl<UserRoleMapper, UserRoleEntity> implements UserRoleService {

    @Override
    public UserRoleEntity getRoleById(Integer id) {
        return lambdaQuery()
                .eq(UserRoleEntity::getUserId, id)
                .one();
    }

    @Override
    public void removeByRoleId(Integer roleId) {
        baseMapper.deleteByRoleId(roleId);
    }
}
